/*
 * PACKAGE NAME: com.jodinfo.outmirror.api.reportlosebarcode.controller
 * FILE    NAME: ReportLoseBarcodeDaoImpl.java
 * COPYRIGHT: Copyright(c) © 2016 heroj Company Ltd. All Rights Reserved
 */ 
package com.jodinfo.outmirror.api.reportlosebarcode.controller;

import java.math.BigInteger;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.alibaba.fastjson.JSON;
import com.hero.common.web.context.UserContext;
import com.hero.core.constant.SysConstant;
import com.hero.core.entity.ResponseEntity;
import com.jodinfo.outmirror.api.reportlosebarcode.entity.ReportLoseBarcodeEntity;
import com.jodinfo.outmirror.api.reportlosebarcode.service.ReportLoseBarcodeBizService;



@Controller
@RequestMapping(value = "/ReportLoseBarcodeAdmin")
public class ReportLoseBarcodeController  {
	
@Resource(name="reportLoseBarcodeBizService")
private ReportLoseBarcodeBizService ReportLoseBarcodeBizService;
/**
*  list数据源
* 
* */
@RequestMapping(value = "/List")
@ResponseBody
public String ReportLoseBarcodeList(ReportLoseBarcodeEntity ReportLoseBarcodeEntity) {
	if(ReportLoseBarcodeEntity==null){
		ReportLoseBarcodeEntity = new ReportLoseBarcodeEntity();
		ReportLoseBarcodeEntity.setPageIndex(SysConstant.DEFAULT_PAGEINDEX);
		ReportLoseBarcodeEntity.setPageSize(SysConstant.DEFAULT_PAGESIZE);
	}
	ReportLoseBarcodeEntity.setCurrentUser(UserContext.getUser());
	String str = ReportLoseBarcodeBizService.queryListForPageReportLoseBarcode(ReportLoseBarcodeEntity);
	return str;
}
/**
* ReportLoseBarcodeEntity List页面
* 
* */
@RequestMapping(value = "/ListPage")
public ModelAndView ReportLoseBarcodeListPage(ReportLoseBarcodeEntity ReportLoseBarcodeEntity,HttpServletRequest request) {
	
	return new ModelAndView(returnPath("ReportLoseBarcodeList"));
}
/**
* ReportLoseBarcodeEntity详细页 
* 
* */
@RequestMapping(value = "/EditPage")
public ModelAndView ReportLoseBarcodeEditPage(ReportLoseBarcodeEntity ReportLoseBarcodeEntity) {
	
	return new ModelAndView(returnPath("ReportLoseBarcodeAdd"));
}
/**
 * 查询ReportLoseBarcodeEntity
 * 
 * */
@RequestMapping(value = "/queryByID")
public @ResponseBody String findReportLoseBarcodeData(HttpServletRequest request) {
	String id = request.getParameter("id");
	ReportLoseBarcodeEntity ReportLoseBarcodeEntity =  ReportLoseBarcodeBizService.queryById(new BigInteger(id));
	return JSON.toJSONString(ReportLoseBarcodeEntity); 
}

/**
 * 保存或更新ReportLoseBarcode 
 * 
 * */
@RequestMapping(value = "/saveReportLoseBarcode")
public @ResponseBody String saveReportLoseBarcodeData(@RequestBody ReportLoseBarcodeEntity ReportLoseBarcodeEntity) {
	ResponseEntity rs = null;
	if(ReportLoseBarcodeEntity!=null){
		ReportLoseBarcodeEntity.setCurrentUser(UserContext.getUser());
		if(ReportLoseBarcodeEntity.getId()!=null){
			rs = ReportLoseBarcodeBizService.updateReportLoseBarcode(ReportLoseBarcodeEntity);
		}else{
			rs = ReportLoseBarcodeBizService.addReportLoseBarcode(ReportLoseBarcodeEntity);
		}
	}
	return JSON.toJSONString(rs);
}
/**
 * 导出ReportLoseBarcodeEntity
 * @author weiwei
 * @date 2015-7-09  下午2:13:28
 * @return
 */
@RequestMapping(value = "/exportReportLoseBarcodeExcel")
public void exportReportLoseBarcodeExcel(ReportLoseBarcodeEntity ReportLoseBarcodeEntity,HttpServletResponse response) {
	ReportLoseBarcodeEntity.setCurrentUser(UserContext.getUser());
	ReportLoseBarcodeBizService.exportReportLoseBarcode(ReportLoseBarcodeEntity, response);
}


 /**
 * 
 * 批量删除
 * @author weiwei
 * @date 2017年3月13日 下午2:48:57
 * @param ReportLoseBarcodeEntity
 * @return
 */
@RequestMapping(value = "/batchDelReportLoseBarcode")
public @ResponseBody String batchDelReportLoseBarcode(ReportLoseBarcodeEntity ReportLoseBarcodeEntity) {
	ResponseEntity rs = null;
	rs = ReportLoseBarcodeBizService.batchDelReportLoseBarcode(ReportLoseBarcodeEntity);
	return  JSON.toJSONString(rs);
}
/**
 * 定义
 * 
 */
private final String MODULE_PATH = "/reportlosebarcode/";

//返回路径
private String returnPath(String jspName) {
	return MODULE_PATH + jspName;
}
}
